//
//  LoadHtml.m
//  MUBATE
//
//  Created by sunbin on 2017/2/27.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "LoadHtml.h"

@interface LoadHtml ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation LoadHtml

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.isNoShowNoNetError = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];

    self.jHUDRect = SCREEN_RECT;


    [self loading];
    WEAKSELF;
    [weakSelf.hudView setJHUDReloadButtonClickedBlock:^() {
        [weakSelf jhudHide:weakSelf.view];
        [weakSelf loading];
    }];
}
- (void)loading{
    NSString *str = [GETARTICLE stringByAppendingString:[NSString stringWithFormat:@"%ld" ,_index]];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:str]];
    [self.webView loadRequest:request];

}


- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
 navigationType:(UIWebViewNavigationType)navigationType{
    NSURL* url = [request URL];
    NSString* urlstring = [NSString stringWithFormat:@"%@",url];
    NSLog(@"urlstring = >%@",urlstring);
    return YES;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{

    [self loadingFailure:@"网络加载失败" refreshTitle:@"refreshTitle" customImage:@"nullData" indicatorViewSize:CGSizeMake(130, 130) showAtView:self.view];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];


}

@end
